package org.come.Frame;

import com.tool.tcpimg.UIUtils;
import org.come.Jpanel.RechargeWebJpanel;
import org.come.until.FormsManagement;

import javax.swing.*;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

/**
 * 充值界面
 * @author admin
 *
 */
public class RechargeWebJframe extends JInternalFrame implements MouseListener {

	private static RechargeWebJpanel rechargeWebJpanel;
	private int first_x, first_y;// x、y坐标

	public static RechargeWebJframe getRankingListJframe() {
		return (RechargeWebJframe) FormsManagement.getInternalForm(3082).getFrame();
	}

	public RechargeWebJframe() {

		super();


		
		
		rechargeWebJpanel = new RechargeWebJpanel();
		this.getContentPane().add(rechargeWebJpanel);

		this.setBorder(BorderFactory.createEmptyBorder());// 去除内部窗体的边框
		((BasicInternalFrameUI) this.getUI()).setNorthPane(null);// 去除顶部的边框

		this.setBounds(0, 0, 1024+500, 1000);// 设置窗口出现的位置
		this.setBackground(UIUtils.Color_BACK);
		this.pack();
		this.setVisible(false);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		this.addMouseListener(this);
		this.addMouseMotionListener(new MouseMotionListener() {// 判断窗口移动的位置

			@Override
			public void mouseMoved(MouseEvent e) {

			}

			@Override
			public void mouseDragged(MouseEvent e) {
				if (isVisible()) {
					int x = e.getX() - first_x;
					int y = e.getY() - first_y;
//					setBounds(x + getX(), y + getY(), getWidth(), getHeight());
				}
			}
		});
	}

	@Override
	public void mouseClicked(MouseEvent e) {
		// TODO Auto-generated method stub
		if(e.getButton() == 1) {
//			FormsManagement.HideForm(3075);
		}
	}

	@Override
	public void mousePressed(MouseEvent e) {
		if (e.isMetaDown()) {
//			FormsManagement.HideForm(3082);
//			this.setVisible(false);
//			RechargeWebJframe.getRechargeWebJpanel().setVisible(false);
			setBounds(12000, 12000, getWidth(), getHeight());
		} else {
//			FormsManagement.Switchinglevel(3082);
		}
		this.first_x = e.getX();
		this.first_y = e.getY();

	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	public static RechargeWebJpanel getRechargeWebJpanel() {
		return rechargeWebJpanel;
	}

	public static void setRechargeWebJpanel(RechargeWebJpanel rechargeWebJpanel) {
		RechargeWebJframe.rechargeWebJpanel = rechargeWebJpanel;
	}

	public int getFirst_x() {
		return first_x;
	}

	public void setFirst_x(int first_x) {
		this.first_x = first_x;
	}

	public int getFirst_y() {
		return first_y;
	}

	public void setFirst_y(int first_y) {
		this.first_y = first_y;
	}
}
